<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src='js/axios.min.js'></script>
</head>
<body>
  <script>
    //简化的ajax请求  基于promise
   /*  fetch('https://jsonplaceholder.typicode.com/photos')
    .then(response => response.json())
    .then(data =>
       data.forEach(element => {
        document.writeln(element.url);
         
       })
    ) */

    /* Axios 网络请求测试 */
    /* axios.get("http://jsonplaceholder.typicode.com/users").then((data)=>{
    data.data.forEach(element => {
      document.write(element.id+"<br>");
      document.write(element.name+"<br>");
      document.write(element.username+"<br>");
      document.write(element.email+"<br>");
      document.write(element.address.city+"<br>");
    });    
    document.writeln("br");  
    }); */


    axios.post("http://jsonplaceholder.typicode.com/users").then((data)=>{
    data.data.forEach(element => {
      document.write(element.id+"<br>");
      document.write(element.name+"<br>");
      document.write(element.username+"<br>");
      document.write(element.email+"<br>");
      document.write(element.address.city+"<br>");
    });    
    document.writeln("br");  
    });
    </script>
</body>
</html>